package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.mappers.ConclusionMapper;
import com.tanhua.model.db.Conclusion;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class ConclusionApiImpl implements ConclusionApi{
    @Autowired
    private ConclusionMapper conclusionMapper;
    @Override
    public Integer findIdByScore(Integer score) {
        QueryWrapper qw = new QueryWrapper();
        qw.ge("max_score",score);
        qw.le("min_score",score);
        Conclusion conclusion = conclusionMapper.selectOne(qw);
        return conclusion.getConclusionId();
    }

    @Override
    public Conclusion findById(Integer conclusionId) {
        QueryWrapper qw = new QueryWrapper();
        qw.eq("conclusion_id",conclusionId);
        return conclusionMapper.selectOne(qw);
    }
}
